Self-punishing, guilt-purging behaviors are very reminiscent of compulsive rituals. The narcissist feels guilty. It could be an "ancient", early childhood, guilt, a "sexual" guilt (Freud), or a "social" guilt. In his infancy, the narcissist internalized and introjected the voices of meaningful and authoritative others - parents, role models, peers - that consistently and convincingly judged him to be no good, blameworthy, deserving of punishment or retaliation, or corrupt.
The narcissist's life is thus transformed into an on-going trial. The constancy of this trial, the never adjourning tribunal is the punishment. It is a Kafkaesque "process": meaningless, undecipherable and never-ending. It leads to no verdict, is subject to mysterious and fluid laws and presided over by capricious judges.
Thus the narcissist masochistically frustrates his deepest desires and drives, obstructs his own efforts, alienates his friends and sponsors, provokes figures of authority to punish, demote, or ignore him, actively seeks and solicits disappointment, failure, or mistreatment and relishes them, incites anger or rejection, bypasses or rejects opportunities, or engages in excessive self-sacrifice.
(From the book "Malignant Self-love: Narcissism Revisited" by Sam Vaknin - Click on this link to purchase: http://www.narcissistic-abuse.com/thebook.html)